<?php

namespace app\admin\model;

use think\Model;

class BuildingZoneModel extends Model
{
    // 表名
    protected $name = 'building_zone';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'create_time';
    protected $updateTime = 'update_time';
    protected $deleteTime = false;

    public function getQuery($scope = [])
    {
        $query = parent::getQuery($scope);
        $user_id = session('admin.id');
        if ($user_id) {
            //$query->where('user_id', $user_id);
            $query->where("find_in_set($user_id,user_id)");
        }
        return $query;
    }
}
